//
//  HomeViewController.m
//  WYModel
//
//  Created by ios on 2017/3/10.
//  Copyright © 2017年 Wy. All rights reserved.
//
//http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/0b85acd4-7927-45f7-b7aa-174d5613f8cb.jpg
//http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/a6223376-9909-4a6e-b75a-9aa95ebf52d8.png
//http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/ca63b23d-2249-46c6-86a7-e61c3f024f56.png

#import "HomeViewController.h"
#import "HomeTabHeadView.h"
#import "NOMoreMsgView.h"

@interface HomeViewController ()<UITableViewDelegate,UITableViewDataSource,HomeTabHeaderViewDelegate>

@property(nonatomic,strong) UITableView      *wTableView;
@property(nonatomic,strong) HomeTabHeadView  *headerView;
@property(nonatomic,strong) NOMoreMsgView    *footerView;
@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self.wTableView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 20;
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 5.0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *cellID = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell ==nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    
    cell.textLabel.text  = [NSString stringWithFormat:@"%ld",indexPath.row];
    return cell;
}

-(void)refreshListViewTitle:(NSString *)title btnIndex:(NSInteger)index{
    
    NSLog(@"点击按钮刷新控制器%@---%ld",title,index);
}


-(UITableView *)wTableView{
    if (!_wTableView) {
        _wTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0,kWidth , kHeight) style:UITableViewStyleGrouped];
        _wTableView.delegate        = self;
        _wTableView.dataSource      = self;
        _wTableView.tableHeaderView = self.headerView;
        _wTableView.tableFooterView = self.footerView;
        
        [self.view addSubview:_wTableView];
    }
    return _wTableView;
}

-(HomeTabHeadView *)headerView{
    if (!_headerView) {
        _headerView = [[HomeTabHeadView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kRate(224))];
        _headerView.delegate = self;
        [_headerView addImageData:@[@"http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/0b85acd4-7927-45f7-b7aa-174d5613f8cb.jpg",@"http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/a6223376-9909-4a6e-b75a-9aa95ebf52d8.png",@"http://bread-live.oss-cn-qingdao.aliyuncs.com/manage/ca63b23d-2249-46c6-86a7-e61c3f024f56.png"]];
        
    }
    return _headerView;
}

-(NOMoreMsgView *)footerView{
    if (!_footerView) {
        _footerView = [[NOMoreMsgView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 80)];
        
    }
    
    return _footerView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
